﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;

namespace doris.Admin {
    public partial class Service : System.Web.UI.Page {
        protected void Page_Load(object sender, EventArgs e) {
            if (Request.QueryString["id"] == null) {
                DetailsView1.ChangeMode(DetailsViewMode.Insert);
            }
        }
        protected void SqlDataSource1_Inserting(object sender, SqlDataSourceCommandEventArgs e) {
            //            CheckBox cbS = (CheckBox)DetailsView1.FindControl("cbUseSSL");
            //            CheckBox cbE = (CheckBox)DetailsView1.FindControl("cbEnabled");

            // putt inn alle 
            e.Command.Parameters["@in_service"].Value = e.Command.Parameters["@Service"].Value;

            e.Command.Parameters.Remove(e.Command.Parameters["@Service"]);
            //            e.Command.Parameters.Remove(e.Command.Parameters["@UseSSL"]);
            //            e.Command.Parameters.Remove(e.Command.Parameters["@Enabled"]);

        }
        protected void SqlDataSource1_Updating(object sender, SqlDataSourceCommandEventArgs e) {
            //            CheckBox cbS = (CheckBox)DetailsView1.FindControl("cbUseSSL");
            //            CheckBox cbE = (CheckBox)DetailsView1.FindControl("cbEnabled");

            // putt inn alle 
            e.Command.Parameters["@in_serviceid"].Value = e.Command.Parameters["@SerivceID"].Value;
            e.Command.Parameters["@in_service"].Value = e.Command.Parameters["@Service"].Value;

            e.Command.Parameters.Remove(e.Command.Parameters["@SerivceID"]);
            e.Command.Parameters.Remove(e.Command.Parameters["@Service"]);
            //            e.Command.Parameters.Remove(e.Command.Parameters["@UseSSL"]);
            //            e.Command.Parameters.Remove(e.Command.Parameters["@Enabled"]);

        }

        protected void SqlDataSource1_Inserted(object sender, SqlDataSourceStatusEventArgs e) {
            Response.Redirect("Services.aspx");
        }
    }
}